﻿using System;
using System.Collections.Generic;
using System.Text;
using Silvermoon.UI;
using Silvermoon.Windows;

namespace Silvermoon.Controls
{
    public static class CheckboxStateManagers
    {

        public static readonly VisualStateManager MetroCheckBox = new VisualStateManager(
            new VisualStateGroup(
                new VisualState(VState.Enabled, 250),
                new VisualState(VState.Disabled,
                    new ColorTransition { Property = Control.TextColorProperty, Duration = 50, To = PhoneColors.Medium },
                    new IntTransition { Property = ChromeControl.BackgroundOpacityProperty, To = 128, Duration = 200 })
            ),
            new VisualStateGroup(
                new VisualState(VState.Normal, 100),
                new VisualState(VState.Pressed,
                    new IntTransition(ChromeControl.ChromeOpacityProperty, 5, null, 255),
                    new ColorTransition(10, null, PhoneColors.White),
                    new ScaleTransition { To = new ScaleTransform(0.96f, 0.96f, 1f), Duration = 5, })
            ),
            new VisualStateGroup(
                new VisualState(VState.Unchecked, new FloatTransition { To = 0f, Duration = 300, Property = CheckBox.OffsetProperty }),
                new VisualState(VState.Checked,
                    new ColorTransition { Property = Control.ColorProperty, To = PhoneColors.Light, Duration = 50 },
                    new FloatTransition { To = 1f, Duration = 300, Property = CheckBox.OffsetProperty })
                )
            );

        public static readonly VisualStateManager CheckboxManager = new VisualStateManager(
          Control.OpacityDisabledEnabledGroup,
          new VisualStateGroup(
              new VisualState(VState.Normal, 500),
              new VisualState(VState.Pressed,
              new FloatTransition
              {
                  Property = CheckBox.YRotationProperty,
                  To = -6f,
                  Duration = 5,
              },
              new ScaleTransition
              {
                  To = new ScaleTransform(0.96f, 0.96f, 1f),
                  Duration = 5,
              }
               )
          ),
          new VisualStateGroup(
              new VisualState(VState.Unchecked,
                  new FloatTransition
                  {
                      To = 0f,
                      Duration = 300,
                      Property = CheckBox.OffsetProperty
                  }
                  ),
              new VisualState(VState.Checked,
                  new FloatTransition
                  {
                      To = 1f,
                      Duration = 300,
                      Property = CheckBox.OffsetProperty
                  }
              )
          )
       );
    }
}
